﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAccess
{
    public class FS0104DataAccess:FSBase_DataAccess
    {
        #region 模糊检索
        public DataTable Search1(string strOrderID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.AppendLine("   select a.iAutoID,a.vcProjectNo,a.vcOrderID,a.vcRequirementID,b.vcRequirementNo  ");
            strSql.AppendLine("   	,b.vcRequirementName,b.vcRequirementDescription,a.vcRequirementContent,a.vcCreateID from(  ");
            strSql.AppendLine("   	select iAutoID,vcProjectNo,vcOrderID,vcRequirementID,vcRequirementContent,vcCreateID from tOrder  ");
            strSql.AppendLine("   	where 1=1  ");
            if (!string.IsNullOrEmpty(strOrderID))
            {
                strSql.AppendLine("   	and vcOrderID like '" + strOrderID + "%'  ");
            }
            
            strSql.AppendLine("   )a  ");
            strSql.AppendLine("   left join(  ");
            strSql.AppendLine("   	select iAutoID,vcRequirementNo,vcRequirementName,vcRequirementDescription from tRequirement  ");
            strSql.AppendLine("   )b on a.vcRequirementID = b.iAutoID  ");
            return Search(strSql.ToString());
        }
        #endregion

        #region 精确检索
        public DataTable Search2(string strOrderID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.AppendLine("   select iAutoID, vcProjectNo, vcOrderID, vcRequirementNo, vcRequirementContent, vcCreateID from tOrder where vcOrderID = '" + strOrderID + "'  ");
            strSql.AppendLine("   where vcOrderID = '" + strOrderID + "'   ");
            return Search(strSql.ToString());
        }
        #endregion

        #region 删除
        public void Delete(List<string> Items)
        {
            StringBuilder strSql = new StringBuilder();
            foreach (var item in Items)
            {
                strSql.AppendLine("   delete tOrder where iAutoID = " + item + "  ");
            }
            update(strSql.ToString());
        }
        #endregion
    }
}
